<script type="text/javascript" src="<?php echo base_url()?>js/jquery.popupWindow.js"></script>
<?php foreach($rs1 as $r)?>
<p>&nbsp;</p>
<div align="center">
  <h1>Raw Material Inspection Report (Pulp Strength)</h1>
</div>
<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="62%" valign="top"><strong>Data Detail<br />
      <br />
      </strong>
      <table width="90%" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#94c0d2">
        <tr>
          <td width="13%" height="32" bgcolor="#DAECF4">&nbsp;Date</td>
          <td width="23%" align="center"><?php echo $r['modify_date']; ?></td>
          <td width="14%" bgcolor="#DAECF4">&nbsp;Gram</td>
          <td width="17%" align="center"><?php echo $r['gram']; ?></td>
          <td width="14%" bgcolor="#DAECF4">&nbsp;Brand</td>
          <td width="19%" align="center"><?php echo $r['brand']; ?></td>
        </tr>
        <tr>
          <td height="30" bgcolor="#DAECF4">&nbsp;Type</td>
          <td align="center"><?php echo $r['type_of']; ?></td>
          <td bgcolor="#DAECF4">&nbsp;Pulp</td>
          <td align="center"><?php echo $r['pulp']; ?></td>
          <td bgcolor="#DAECF4">&nbsp;Problem</td>
          <td align="center">&nbsp;</td>
        </tr>
        <tr>
          <td height="30" colspan="6" align="center"><table width="99%" align="center">
            <tr>
              <td width="77%" align="center"><?php if($r["status"] == 1)
    { echo "<h2>Status :: <font color=green>ผ่านการทดสอบ</font></h2>";} 
    else 
    {
    	echo "<h2>Status :: <font color=red>ไม่ผ่านการทดสอบ</font></h2>";
      
     } 
    ?></td>
              <td width="23%" align="center"><a href="<?php echo base_url();?>index.php/comment/Addcomment/<?php echo $r['t_id']; ?>" class="example1demo"><img src="<?php echo base_url();?>css/comment.png" width="50" height="41" /></a><br />
                เขียนคอมเมนต์
                <script type="text/javascript"> 
				$('.example1demo').popupWindow({ 
				height:600, 
				width:500, 
				top:100, 
				left:400 
				}); 
				</script></td>
            </tr>
          </table></td>
        </tr>
      </table></td>
    <td width="38%" valign="top"><strong>Work Flow<br />
      <br />
      </strong>
      <table width="98%" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#94c0d2">
        <tr>
          <td width="14%" align="center" height="32" bgcolor="#DAECF4">flow no</td>
          <td width="31%" align="center" bgcolor="#DAECF4">Approve By</td>
          <td width="20%" align="center" bgcolor="#DAECF4">Start Time</td>
          <td width="20%" align="center" bgcolor="#DAECF4">End Time</td>
          <td width="30%" align="center" bgcolor="#DAECF4">Flow Status</td>
        </tr>
        <?php 
  $run = 1;
  foreach($instance_flow as $r)
	{
  echo "<tr>";
  echo "<td height='30' align = 'center'>".$run."</td>";
  echo "<td>".$r['user_approve']."</td>";
  echo "<td>".$r['startTime']."</td>";
  echo "<td>".$r['endTime']."</td>";
  echo "<td align='center'>".$r['status']."</td>";
  echo "</tr>";
  $run++;
  }
  ?>
      </table></td>
  </tr>
</table>
<p>&nbsp;</p>
<table width="60%" align="center" class="font">
  <tr>
    <td>
     <table id="grid">
                <thead>
                    <tr>
                        <th data-field="Properties">Properties Item</th>
                        <th data-field="Value">Value</th>
                        <th data-field="Unit">Unit</th>
                    </tr>
                </thead>
                <tbody>
<tr>
<td>Furnish Machine</td><td><?php 
			  foreach($rs2 as $r)
			  {
				  if($r['data_name']== 'pulpstrengthPS11')
				  {
				  	if($r['status']== '1')
						{
							echo $r['data_value'];
						}
					else
						{
			echo "<span class='red'>"."<strong>".$r['data_value']."</strong>"."</span>";
						}
				  }
			  }
			  ?></td><td>%</td>
</tr>
<tr>
<td>Consistency</td><td><?php 
			  foreach($rs2 as $r)
			  {
				  if($r['data_name']== 'pulpstrengthPS12')
				  {
				  	if($r['status']== '1')
						{
							echo $r['data_value'];
						}
					else
						{
			echo "<span class='red'>"."<strong>".$r['data_value']."</strong>"."</span>";
						}
				  }
			  }
			  ?></td>
<td>%</td>
</tr>
<tr>
<td>Freeness,CSF</td><td><?php 
			  foreach($rs2 as $r)
			  {
				  if($r['data_name']== 'pulpstrengthPS13')
				  {
				  	if($r['status']== '1')
						{
							echo $r['data_value'];
						}
					else
						{
			echo "<span class='red'>"."<strong>".$r['data_value']."</strong>"."</span>";
						}
				  }
			  }
			  ?></td><td>ml</td>
</tr>
<tr>
<td>Drainage Time</td><td><?php 
			  foreach($rs2 as $r)
			  {
				  if($r['data_name']== 'pulpstrengthPS14')
				  {
				  	if($r['status']== '1')
						{
							echo $r['data_value'];
						}
					else
						{
			echo "<span class='red'>"."<strong>".$r['data_value']."</strong>"."</span>";
						}
				  }
			  }
			  ?></td><td>sec</td>
</tr>
<tr>
<td>Basis Weight (BD.) </td><td><?php 
			  foreach($rs2 as $r)
			  {
				  if($r['data_name']== 'pulpstrengthPS15')
				  {
				  	if($r['status']== '1')
						{
							echo $r['data_value'];
						}
					else
						{
			echo "<span class='red'>"."<strong>".$r['data_value']."</strong>"."</span>";
						}
				  }
			  }
			  ?></td><td>gsm</td>
</tr>
<tr>
<td>Caliper</td><td><?php 
			  foreach($rs2 as $r)
			  {
				  if($r['data_name']== 'pulpstrengthPS16')
				  {
				  	if($r['status']== '1')
						{
							echo $r['data_value'];
						}
					else
						{
			echo "<span class='red'>"."<strong>".$r['data_value']."</strong>"."</span>";
						}
				  }
			  }
			  ?></td><td>mm</td>
</tr>
<tr>
<td>Density</td><td><?php 
			  foreach($rs2 as $r)
			  {
				  if($r['data_name']== 'pulpstrengthPS17')
				  {
				  	if($r['status']== '1')
						{
							echo $r['data_value'];
						}
					else
						{
			echo "<span class='red'>"."<strong>".$r['data_value']."</strong>"."</span>";
						}
				  }
			  }
			  ?></td>
<td>g/cm<sup>2</sup></td>
</tr>
<tr>
<td>Bulk</td><td><?php 
			  foreach($rs2 as $r)
			  {
				  if($r['data_name']== 'pulpstrengthPS18')
				  {
				  	if($r['status']== '1')
						{
							echo $r['data_value'];
						}
					else
						{
			echo "<span class='red'>"."<strong>".$r['data_value']."</strong>"."</span>";
						}
				  }
			  }
			  ?></td><td>cm<sup>3</sup>/g</td>
</tr>
<tr>
<td>Tensile Index</td><td><?php 
			  foreach($rs2 as $r)
			  {
				  if($r['data_name']== 'pulpstrengthPS19')
				  {
				  	if($r['status']== '1')
						{
							echo $r['data_value'];
						}
					else
						{
			echo "<span class='red'>"."<strong>".$r['data_value']."</strong>"."</span>";
						}
				  }
			  }
			  ?></td><td>N.m/g</td>
</tr>
<tr>
<td>Tear Index</td><td><?php 
			  foreach($rs2 as $r)
			  {
				  if($r['data_name']== 'pulpstrengthPS20')
				  {
				  	if($r['status']== '1')
						{
							echo $r['data_value'];
						}
					else
						{
			echo "<span class='red'>"."<strong>".$r['data_value']."</strong>"."</span>";
						}
				  }
			  }
			  ?></td><td>mN.m<sup>2</sup>/g</td>
</tr>
<tr>
<td>Burst Index</td><td><?php 
			  foreach($rs2 as $r)
			  {
				  if($r['data_name']== 'pulpstrengthPS21')
				  {
				  	if($r['status']== '1')
						{
							echo $r['data_value'];
						}
					else
						{
			echo "<span class='red'>"."<strong>".$r['data_value']."</strong>"."</span>";
						}
				  }
			  }
			  ?></td><td>kPa.m<sup>2</sup>/g</td>
</tr>
<tr>
<td>Bending Stiffness Index</td><td><?php 
			  foreach($rs2 as $r)
			  {
				  if($r['data_name']== 'pulpstrengthPS22')
				  {
				  	if($r['status']== '1')
						{
							echo $r['data_value'];
						}
					else
						{
			echo "<span class='red'>"."<strong>".$r['data_value']."</strong>"."</span>";
						}
				  }
			  }
			  ?></td><td>mN/g</td>
</tr>
<tr>
<td>Folding</td><td><?php 
			  foreach($rs2 as $r)
			  {
				  if($r['data_name']== 'pulpstrengthPS23')
				  {
				  	if($r['status']== '1')
						{
							echo $r['data_value'];
						}
					else
						{
			echo "<span class='red'>"."<strong>".$r['data_value']."</strong>"."</span>";
						}
				  }
			  }
			  ?></td><td>Times</td>
</tr>
<tr>
<td>L*</td><td><?php 
			  foreach($rs2 as $r)
			  {
				  if($r['data_name']== 'pulpstrengthPS24')
				  {
				  	if($r['status']== '1')
						{
							echo $r['data_value'];
						}
					else
						{
			echo "<span class='red'>"."<strong>".$r['data_value']."</strong>"."</span>";
						}
				  }
			  }
			  ?></td><td>&nbsp;</td>
</tr>
<tr>
  <td>a*</td>
  <td><?php 
			  foreach($rs2 as $r)
			  {
				  if($r['data_name']== 'pulpstrengthPS25')
				  {
				  	if($r['status']== '1')
						{
							echo $r['data_value'];
						}
					else
						{
			echo "<span class='red'>"."<strong>".$r['data_value']."</strong>"."</span>";
						}
				  }
			  }
			  ?></td>
  <td>&nbsp;</td>
</tr>
<tr>
  <td>b*</td>
  <td><?php 
			  foreach($rs2 as $r)
			  {
				  if($r['data_name']== 'pulpstrengthPS26')
				  {
				  	if($r['status']== '1')
						{
							echo $r['data_value'];
						}
					else
						{
			echo "<span class='red'>"."<strong>".$r['data_value']."</strong>"."</span>";
						}
				  }
			  }
			  ?></td>
  <td>&nbsp;</td>
</tr>
<tr>
  <td>ISO Brightness</td>
  <td><?php 
			  foreach($rs2 as $r)
			  {
				  if($r['data_name']== 'pulpstrengthPS27')
				  {
				  	if($r['status']== '1')
						{
							echo $r['data_value'];
						}
					else
						{
			echo "<span class='red'>"."<strong>".$r['data_value']."</strong>"."</span>";
						}
				  }
			  }
			  ?></td>
  <td>%</td>
</tr>
<tr>
  <td>Opacity</td>
  <td><?php 
			  foreach($rs2 as $r)
			  {
				  if($r['data_name']== 'pulpstrengthPS28')
				  {
				  	if($r['status']== '1')
						{
							echo $r['data_value'];
						}
					else
						{
			echo "<span class='red'>"."<strong>".$r['data_value']."</strong>"."</span>";
						}
				  }
			  }
			  ?></td>
  <td>%</td>
</tr>
<tr>
  <td>Scattering Coeff.</td>
  <td><?php 
			  foreach($rs2 as $r)
			  {
				  if($r['data_name']== 'pulpstrengthPS29')
				  {
				  	if($r['status']== '1')
						{
							echo $r['data_value'];
						}
					else
						{
			echo "<span class='red'>"."<strong>".$r['data_value']."</strong>"."</span>";
						}
				  }
			  }
			  ?></td>
  <td>m<sup>2</sup>/kg</td>
</tr>
<tr>
  <td>Absorption Coeff.</td>
  <td><?php 
			  foreach($rs2 as $r)
			  {
				  if($r['data_name']== 'pulpstrengthPS30')
				  {
				  	if($r['status']== '1')
						{
							echo $r['data_value'];
						}
					else
						{
			echo "<span class='red'>"."<strong>".$r['data_value']."</strong>"."</span>";
						}
				  }
			  }
			  ?></td>
  <td>m<sup>2</sup>/kg</td>
</tr>
<tr>
  <td>CIE Whiteness</td>
  <td><?php 
			  foreach($rs2 as $r)
			  {
				  if($r['data_name']== 'pulpstrengthPS31')
				  {
				  	if($r['status']== '1')
						{
							echo $r['data_value'];
						}
					else
						{
			echo "<span class='red'>"."<strong>".$r['data_value']."</strong>"."</span>";
						}
				  }
			  }
			  ?></td>
  <td>&nbsp;</td>
</tr>
<tr>
  <td>Porosity (Oil Gurley )</td>
  <td><?php 
			  foreach($rs2 as $r)
			  {
				  if($r['data_name']== 'pulpstrengthPS32')
				  {
				  	if($r['status']== '1')
						{
							echo $r['data_value'];
						}
					else
						{
			echo "<span class='red'>"."<strong>".$r['data_value']."</strong>"."</span>";
						}
				  }
			  }
			  ?></td>
  <td>sec / 100 ml</td>
</tr>
<tr>
  <td>Tensile stiffness index</td>
  <td><?php 
			  foreach($rs2 as $r)
			  {
				  if($r['data_name']== 'pulpstrengthPS33')
				  {
				  	if($r['status']== '1')
						{
							echo $r['data_value'];
						}
					else
						{
			echo "<span class='red'>"."<strong>".$r['data_value']."</strong>"."</span>";
						}
				  }
			  }
			  ?></td>
  <td>KN/Kg </td>
</tr>
<tr>
  <td>Ash</td>
  <td><?php 
			  foreach($rs2 as $r)
			  {
				  if($r['data_name']== 'pulpstrengthPS34')
				  {
				  	if($r['status']== '1')
						{
							echo $r['data_value'];
						}
					else
						{
			echo "<span class='red'>"."<strong>".$r['data_value']."</strong>"."</span>";
						}
				  }
			  }
			  ?></td>
  <td>%</td>
</tr>

                </tbody>
      </table>

            <script>
                $(document).ready(function() {
                    $("#grid").kendoGrid({
						columns: [
						{ field: "Properties", width: "125px" },
						{ field: "Value", width: "20px" },
						{ field: "Unit",  width: "40px" }
						],
                        //height: 1000,
						//pageable: true,
						dataSource: {
						//pageSize: 12
						} 
                    });
                });
            </script>
    </td>
  </tr>
</table>

            <!--scrip list select-->
<script>
                $(document).ready(function() {
                    var viewModel = {
                        chosenTicket: ko.observable(),
                        resetTicket: function() { this.chosenTicket(null) },
                    };
                    $("#ticket1").kendoDropDownList().trigger("change");
                    $("#ticket2").kendoDropDownList().trigger("change");
                    $("#ticket3").kendoDropDownList().trigger("change");
                    $("#ticket4").kendoDropDownList().trigger("change");
                });
      		</script>
            <!--scrip วัน-เดือน-ปี-->
<script>
                $(document).ready(function() {
                    var today = new Date(),
                        birthdays = [
                           +new Date(today.getFullYear(), today.getMonth(), 11),
                           +new Date(today.getFullYear(), today.getMonth() + 1, 6),
                           +new Date(today.getFullYear(), today.getMonth() + 1, 27),
                           +new Date(today.getFullYear(), today.getMonth() - 1, 3),
                           +new Date(today.getFullYear(), today.getMonth() - 2, 22)
                        ];

                    $("#datepicker").kendoDatePicker({
                        value: today,
                        month: {
                            // template for dates in month view
                            content: '# if ($.inArray(+data.date, [' + birthdays + ']) != -1) { #' +
                                         '<div class="birthday"></div>' +
                                     '# } #' +
                                     '#= data.value #'
                        },
                        footer: "Today - #=kendo.toString(data, 'd') #"
                    });

                    $("#datepicker").data("kendoDatePicker")
                                    .dateView.calendar.element
                                    .width(300);
                });
            </script>
            <!--scrip เวลา-->
<script>
                $(document).ready(function() {
                    // create TimePicker from input HTML element
                    $("#timepicker").kendoTimePicker();
                });
            </script>